﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Configuration;
using System.Web.Mvc;

namespace MySite.Models
{
    public class ChangePasswordModel
    {
        [DataType(DataType.Password)]
        [Display(Name = "Confirm new password")]
        [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "New password")]
        public string NewPassword { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "Current password")]
        public string OldPassword { get; set; }
    }

    public class LogOnModel
    {
        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [Display(Name = "Remember me?")]
        public bool RememberMe { get; set; }

        [Required]
        [Display(Name = "User name")]
        public string UserName { get; set; }
    }

    public class RegisterModel
    {
        [Required]
        [StringLength(16, ErrorMessage = "The {0} must be between {2} and {1} characters long.", MinimumLength = 6)]
        [RegularExpression(@"[a-zA-Z0-9]*", ErrorMessage = "{0} contains invalid characters. (A-Z)|(0-9) only.")]
        [Display(Name = "User name")]
        public string UserName { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [RegularExpression(@"[a-zA-Z0-9!@#$%^&*_]*", ErrorMessage = "{0} contains invalid characters. (A-Z)|(0-9)|(!@#$%^&*_) only.")]
        
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Confirm password")]
        [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }

        [Required]
        [DataType(DataType.EmailAddress)]
        [RegularExpression(@"[a-zA-Z0-9]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}", ErrorMessage = "The value entered is not a valid e-mail address. Must of the form email@domain")]
        [Display(Name = "Email address")]
        public string Email { get; set; }

        [Required]
        public string PasswordAnswer { get; set; }

        [Required]
        public string PasswordQuestion { get; set; }
    }

    public class PasswordQuestionSet
    {
        public List<String> Questions { get; set; }
        public PasswordQuestionSet()
        {
            Questions = new List<string>();
            Questions.Add("What is your mothers maiden name?");
            Questions.Add("What is the name of your first boyfriend/girlfriend?");
            Questions.Add("What is your favorite band?");
            Questions.Add("How many toes do you have?");
        }
    }

    public class ResetPasswordModel
    {
        [Display(Name = "Security Question")]
        public string Question { set; get; }

        [Required]
        [Display(Name = "User name")]
        public string UserName { get; set; }
    }
}